package net.hands.ctx.element;

import net.hands.common.StringUtils;

/**
 * 说明: <br>
 * <p>
 * 这是一个开源的软件，请在LGPLv3下合法使用、修改或重新发布。
 * </p>
 * 
 * @title A.java
 * @package net.simpleframework.common.web.html.element
 * @author shihb(shihaibin.sea@gmail.com, 13466609192)
 *         <p>
 *         http://code.google.com/p/simpleframework/
 *         </p>
 *         <p>
 *         http://www.simpleframework.net
 *         </p>
 * @update 2013-1-7 下午11:42:55
 */

public class A extends AbstractElement<A> {
	private String accesskey;
	/*
	 * HTML 5 中不支持。 private String charset;
	 */
	private String className;
	private String contenteditable;
	/*
	 * HTML 5 中不支持。 private String coords;
	 */
	private String datafld;
	private String datasrc;
	private String dir;
	private String disabled;
	private String hidefocus;
	/**
	 * 链接的目标 URL
	 */
	private String href;
	/**
	 * 规定目标 URL 的基准语言。仅在 href 属性存在时使用。
	 */
	private String hreflang;
	private String lang;
	private String language;
	private String methods;
	/**
	 * 规定目标 URL 的媒介类型。 默认值：all。仅在 href 属性存在时使用。
	 */
	private String media;
	/*
	 * HTML 5 中不支持。 private String name;
	 */
	/**
	 * 规定当前文档与目标 URL 之间的关系。 仅在 href 属性存在时使用。
	 */
	private String rel;
	/*
	 * HTML 5 中不支持。 private String rev; private String shape;
	 */

	private String tabindex;
	/**
	 * 在何处打开目标 URL。仅在 href 属性存在时使用。
	 */
	private String target;
	private String title;
	/**
	 * 规定目标 URL 的 MIME 类型。
	 */
	private String type;
	private String unselectable;
	private String urn;

	public String getAccesskey() {
		return accesskey;
	}

	public void setAccesskey(String accesskey) {
		this.accesskey = accesskey;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getContenteditable() {
		return contenteditable;
	}

	public void setContenteditable(String contenteditable) {
		this.contenteditable = contenteditable;
	}

	public String getDatafld() {
		return datafld;
	}

	public void setDatafld(String datafld) {
		this.datafld = datafld;
	}

	public String getDatasrc() {
		return datasrc;
	}

	public void setDatasrc(String datasrc) {
		this.datasrc = datasrc;
	}

	public String getDir() {
		return dir;
	}

	public void setDir(String dir) {
		this.dir = dir;
	}

	public String getDisabled() {
		return disabled;
	}

	public void setDisabled(String disabled) {
		this.disabled = disabled;
	}

	public String getHidefocus() {
		return hidefocus;
	}

	public void setHidefocus(String hidefocus) {
		this.hidefocus = hidefocus;
	}

	public String getHref() {
		return href;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public String getHreflang() {
		return hreflang;
	}

	public void setHreflang(String hreflang) {
		this.hreflang = hreflang;
	}

	public String getLang() {
		return lang;
	}

	public void setLang(String lang) {
		this.lang = lang;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getMethods() {
		return methods;
	}

	public void setMethods(String methods) {
		this.methods = methods;
	}

	public String getMedia() {
		return media;
	}

	public void setMedia(String media) {
		this.media = media;
	}

	public String getRel() {
		return rel;
	}

	public void setRel(String rel) {
		this.rel = rel;
	}

	public String getTabindex() {
		return tabindex;
	}

	public void setTabindex(String tabindex) {
		this.tabindex = tabindex;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getUnselectable() {
		return unselectable;
	}

	public void setUnselectable(String unselectable) {
		this.unselectable = unselectable;
	}

	public String getUrn() {
		return urn;
	}

	public void setUrn(String urn) {
		this.urn = urn;
	}

	@Override
	public String toString() {
		
		final StringBuilder sb = new StringBuilder();
		sb.append("<a");
		doAttri(sb);
		final String txt = getText();
		if (StringUtils.hasText(txt)) {
			sb.append(">").append(txt).append("</a>");
		} else {
			sb.append(" />");
		}
		return sb.toString();
	}
}
